﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GnufWidgetAgent.h"
#include <QtWidgets/QWidget>
#include "GnufQtItem.h"
#include <QtCore/QPointer>

namespace gnuf {

    class GNUF_BASE_EXPORT QtWidgetAgent : public QtItemWith<QObject, WidgetAgent>
    {
        Q_OBJECT
    public:
        QtWidgetAgent(WidgetAgent *);
        virtual ~QtWidgetAgent();

        virtual QWidget * castQWidget() override;
        virtual void refresh(EWhatDirty) override;
        virtual void destroy() override;
        void sendEvent();
        void onTableRowSelectionChanged(bool);

    protected:
        // Inherits from QObject...
        virtual bool eventFilter(QObject *, QEvent *) override;

    private:
        QPointer<QWidget> m_qtWidget;
        const bool m_transferOwnership;
    };

}
